  <template>
  <div>
      <el-button type="danger" @click="allDelete">批量删除</el-button>
    <el-table
      :data="tableData"
      style="width: 100%">
      <el-table-column
        prop="createTime"
        label="日期"
        width="280">
      </el-table-column>
      <el-table-column
        prop="userName"
        label="用户姓名"
        width="280">
      </el-table-column>
     <el-table-column
        prop="AritcleId.aTitle"
        label="评论文章"
        width="280">
      </el-table-column>
      <el-table-column
        prop="content"
        label="内容"
        width="280">
      </el-table-column>
      <el-table-column
        label="评论"
        width="280"
      >
        <template slot-scope="scope">
          <el-button type="danger" plain @click="Delete(scope.row._id)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    </div>
  </template>
<script>
import {getAllCom,DeleteCom} from "@/service/getData.js"
export default{
      data() {
        return {
          tableData: []
        }
      },created(){
        getAllCom().then((data) =>{
          this.tableData=data.data;
        });
      },methods: {
        Delete(val){
          DeleteCom(val);
          getAllCom().then((data) =>{
          this.tableData=data.data;
        });
        },allDelete(){
          this.$router.push('/home/deleteAllCom');
        }
      }
}
</script>

<style>

</style>